/***** Serendipity Booksellers -- bookCollection.h header file *****/
#ifndef BOOK_COLLECTION
#define BOOK_COLLECTION

// This class represents the collection of all books.
#include "bookdata.h"
#include <fstream>
#include <vector>
#include <list>

class BookCollection
{
	list<BookData> bookList; // List of BookData objects
public:
	void addBook();
	/****************************************************
	 * NEW ADDED										*
	 ****************************************************/
	void deleteBook();
  void editBook();
  void editBookFields(BookData &);
  int  bookFieldMenu(BookData);
	/****************************************************/
	// void editBook();
	void lookUpBook();
	list<BookData>::iterator BookCollection::lookupIsbn(string isbn);
	list<BookData>::iterator end() { return bookList.end();}
	void erase(list<BookData>::iterator iter) { bookList.erase(iter); }
	void displayIsbn();
	bool booksAvailable();

	// Reporting functions
	void repListing();
	void repWholesale();
	void repRetail();
	void repQty();
	void repCost();
	void repAge();

private:
	// Aucilliary functions for matching titles
	list<BookData>::iterator find(string title);
	void match (string title, vector<list<BookData>::iterator>&found);
	void partialMatch(string partialTitle, vector<list<BookData>::iterator> &found);
	void displayBooks(vector<list<BookData>::iterator> &);

	// File object I/O
	fstream file;

public:
	BookCollection(); // Constructor
	~BookCollection(); // Destructor

private:
	void sortByQty(BookData book[ ], int numberBooks);
};

#endif